import {
  Body,
  Controller,
  Delete,
  Get,
  Param,
  Patch,
  Post,
  Query,
} from '@nestjs/common';
import { MeetingRoomService } from './meeting-room.service';
import { PaginDto } from 'src/commen/dto';
import {
  CreateMeetingRommDto,
  UpdateMeetingRoom,
} from './dtos/meeting-room.dto';
import { RequireLogin } from 'src/decorators/custom-decorator';

@Controller('meeting-room')
export class MeetingRoomController {
  constructor(private readonly meetingRoomService: MeetingRoomService) {}
  @Get()
  @RequireLogin()
  async list(@Query() params: PaginDto) {
    return await this.meetingRoomService.list(params);
  }
  @Post()
  @RequireLogin()
  async create(@Body() createMeetingRoom: CreateMeetingRommDto) {
    return await this.meetingRoomService.store(createMeetingRoom);
  }

  @Patch()
  @RequireLogin()
  async update(@Body() updateMeetingRoomDto: UpdateMeetingRoom) {
    return await this.meetingRoomService.updateMeetingRoom(
      updateMeetingRoomDto,
    );
  }
  @Get(':id')
  @RequireLogin()
  async findById(@Param('id') id: number) {
    return await this.meetingRoomService.findById(id);
  }
  @Delete(':id')
  @RequireLogin()
  async delete(@Param('id') id: number) {
    return await this.meetingRoomService.delete(id);
  }
}
